import com.atguigu.realtime.bean.KeywordBean;

import java.lang.reflect.Field;

/**
 * @Author lzc
 * @Date 2023/3/17 15:26
 */
public class Demo4 {
    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
    
        KeywordBean bean = new KeywordBean();
        Class<KeywordBean> tClass = KeywordBean.class;
        
        
        // 得到 stt 属性
        Field stt = tClass.getDeclaredField("stt");  // obj.stt="abc"
        stt.setAccessible(true);  // 设置属性可以访问
        
        stt.set(bean, "abc");
    
       // System.out.println(bean);
    
        System.out.println(stt.get(bean));
    
    
    }
}
